const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
	transpileDependencies: true,
	lintOnSave: false,
	publicPath:'/',
	outputDir: 'platform',
	assetsDir: 'static',
	// lintOnSave: process.env.NODE_ENV === 'development',
	productionSourceMap: false,
	devServer: {
		port: 8080,
		open: false,
		// overlay: {
		// 	warnings: false,
		// 	errors: true
		// },
		// 跨域配置
		// proxy: {
		// 	[process.env.VUE_APP_BASE_API]: {
		// 		target: ' https://htzg.bjxzkj.com.cn:28021/api/',
		// 		changeOrigin: true,
		// 		pathRewrite: {
		// 			['^' + process.env.VUE_APP_BASE_API]: ''
		// 		}
		// 	}
		// },
	},
    chainWebpack: config => {
		// when there are many pages, it will cause too many meaningless requests
		config.plugins.delete('prefetch')

		config
			.when(process.env.NODE_ENV !== 'development',
				config => {
					config.optimization.runtimeChunk('single')
					// 生产模式 console.log 去除
					config.optimization
						.minimizer('terser')
						.tap(args => {
							Object.assign(args[0].terserOptions.compress, { 
								// warnings: false , // 默认 false
								// drop_console:  ,
								drop_debugger: false, // 默认也是true 
								pure_funcs: ['console.log']
							})
							return args
						})
				}
			)
      config
        .plugin('html')
        .tap(args => {
          args[0].title= process.env.VUE_APP_TITLE
          return args
        })
    }
})
